package xiangmu.schoolpaper.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import xiangmu.schoolpaper.pojo.DTO.HorizontalCompareStudentsDTO;
import xiangmu.schoolpaper.pojo.DTO.VertialComparisonDTO;
import xiangmu.schoolpaper.pojo.DTO.VerticalComparisonStudentIdDTO;
import xiangmu.schoolpaper.result.Result;
import xiangmu.schoolpaper.service.VerticalComprisonService;

import java.util.List;

@RestController
@RequestMapping
@Slf4j
@Tag(name="纵向对比单个学生所有论文（某教师指导的所有学生）")
public class AnalyzeVertivalComparisonController {
    @Autowired
    private VerticalComprisonService verticalComprisonService;
    @Operation(summary="获取某教师指导的所有学生的学号和姓名")//剔除（年份为筛选条件，默认是最新一年）
    @GetMapping("/teacher/vertical-compare-one-student/getAllStudentsByTeacher")
    public Result getAllStudentsByTeacher(@RequestParam("id") Integer teacher){
        log.info("获取某教师指导的所有学生的学号和姓名（年份为筛选条件，默认是最新一年）");
        List<VertialComparisonDTO> list=verticalComprisonService.getAllStudentsByTeacher(teacher);
        return Result.success(list);
    }
    @Operation(summary="获取某学生的所有论文分数情况")
    @GetMapping("/teacher/verticalCompareOneStudent/getAllPaperByStudent")
    public Result getAllPaperByStudent(String studentId){
        log.info("获取某学生的所有论文分数情况");
        List<HorizontalCompareStudentsDTO> list=verticalComprisonService.getAllPaperByStudent(studentId);
        return Result.success(list);
    }
    @Operation(summary="获取该教师指导过学生的所有年份")
    @GetMapping("/teacher/horizontalCompareStudents/getAllYearsByTeacher")
    public Result getAllYearsByTeacher(@RequestParam("id") Integer teacher){
        log.info("获取该教师指导过学生的所有年份");
        List<Integer> list=verticalComprisonService.getAllYearsByTeacher(teacher);
        return Result.success(list);
    }
    @Operation(summary="获取某教师最新一年指导的所有学生最后一次论文分数")
    @GetMapping("/teacher/horizontalCompareStudents/getAllPaperByTeacher")
    public Result getAllPaperByTeacher(@RequestParam Integer teacher,@RequestParam Integer year){
        log.info("获取某教师最新一年指导的所有学生最后一次论文分数");
        List<HorizontalCompareStudentsDTO> list = verticalComprisonService.getAllPaperByTeacher(teacher,year);
        return Result.success(list);
    }




}
